package com.zboin.ucenter.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.zboin.ucenter.model.Role;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.util.List;

/**
 * @author zhboom
 * @date 2025/8/4 23:17
 */
@Mapper
public interface RoleMapper extends BaseMapper<Role> {

    @Select("select r.* from user_center.user_role ur " +
            "left join user_center.role r on ur.role_id = r.role_id " +
            "where ur.user_id = #{userId} and r.is_valid = 1;")
    List<Role> getRoleByUserId(Integer userId);
}
